/**
 * 
 */
package com.kunbo.cn.controller.core.inventory;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.codehaus.jackson.map.ObjectMapper;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.kunbo.cn.entity.core.inventory.UserAuthority;
import com.kunbo.cn.entity.core.purchase.SaleWaybill;
import com.kunbo.cn.service.core.inventory.UserAuthorityService;
import com.kunbo.cn.util.json.FastJsonUtils;
import com.kunbo.cn.util.retu.CommonResult;

/**
 *承运商用户授权
 * @author bjl  
 * @date 2019年3月14日 
 */
@RestController  
@RequestMapping("/UserAuthority")  
public class UserAuthorityController {
	@Autowired
	private UserAuthorityService Authservice;
	@PostMapping("/add")
	public CommonResult add(String mydata) {
			List <UserAuthority> list=FastJsonUtils.toList(mydata,UserAuthority.class);
			Authservice.save(list);
		return new CommonResult(true,"操作成功",null);
	}
	@DeleteMapping("/delete")
	public CommonResult delete(String id) {
		Authservice.delete(id);
		return new CommonResult(true,"操作成功",null);
	}
	/**
	 *条件分页查询
	 * 
	 */
	@GetMapping("/list")
	public List<Map<String, Object>> list(String userid) {
		List<Map<String, Object>> list = Authservice.findUserAuthority(userid);
		return list;
	}
}
